package org.patterns.behavior.observer;


public class Client {
    public static void main(String[] args) {
        //定义观察目标对象
        AllyControlCenter acCenter = new ConcreteAllyControlCenter("金庸群侠");
        System.out.println("----------------------------");

        //定义四个观察者对象
        Observer player1 = new Player("杨过");
        acCenter.join(player1);

        Observer player2 = new Player("令狐冲");
        acCenter.join(player2);

        Observer player3 = new Player("张无忌");
        acCenter.join(player3);

        Observer player4 = new Player("段誉");
        acCenter.join(player4);

        System.out.println("----------------------------");
        //某成员遭受攻击
        player1.beAttacked(acCenter);
    }
}
